class Date{
    int year = 1900;
    int month = 10;
    int day = 1;

    Date(int year,int month,int day){
        this.year = year;
        this.month = month;
        this.day = day;
    }
    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    @Override
    public String toString() {
        /*return "Date{" +
                "year=" + year +
                '}';
         */
        return "hello world";
    }

    public void print(){
        System.out.println("年 " + year + " 月 " + month + " 日 " + day);
    }
}

public class test {
    public static void main(String[] args) {
        Date date = new Date(1000,1,1);
        date.print();
        // 直接打印,不调用源码中的toString,调用自己的toString
        System.out.println(date);
    }

    
}
